package com.gress.shop.service.impl;

import com.gress.shop.bo.Member;
import com.gress.shop.service.ISsoService;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Service;

/**
 * Created xiongwen with 2018/3/7 21:42
 * Description:
 */
@Service
public class SsoService implements ISsoService {

    @Override
    public Member getLoginMember() {
        return shrioSessionMember();
    }

    @Override
    public String getLoginEmail() {
        return shrioSessionMember().getEmail();
    }

    @Override
    public String getLoginName() {
        return shrioSessionMember().getName();
    }

    private Member shrioSessionMember() {
        return (Member) SecurityUtils.getSubject().getPrincipal();
    }
}
